package nd.android.am.bean;

public class Settlement {

	private String user;
	private double outlayAmount;
	private double consumeAmount;
	
	public Settlement(String user) {
		this.user = user;
	}
	
	public String getUser() {
		return user;
	}
	public double getOutlayAmount() {
		return outlayAmount;
	}
	public double getConsumeAmount() {
		return consumeAmount;
	}
	public double getBalance() {
		return outlayAmount - consumeAmount;
	}
	
	/** 增加支出 */
	public void addOutlay(double outlay){
		outlayAmount += outlay;
	}
	
	/** 增加消费 */
	public void addConsume(double consume){
		consumeAmount += consume;
	}

	public String toString(){
		StringBuilder sb = new StringBuilder(user);
		sb.append("\t").append(Math.floor(outlayAmount * 100) / 100);
		sb.append("\t").append(Math.floor(consumeAmount * 100) / 100);
		sb.append("\t").append(Math.floor(getBalance() * 100) / 100);
		return sb.toString();
	}
}
